package com.example.administrator.maizuofilm.hot.adapter;

import android.content.Context;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.example.administrator.maizuofilm.R;
import com.example.administrator.maizuofilm.activitymain.MainActivity;
import com.example.administrator.maizuofilm.bean.Hot;
import com.example.administrator.maizuofilm.bean.NotShow;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.drawable.ProgressBarDrawable;
import com.facebook.drawee.drawable.ScalingUtils;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.facebook.drawee.view.SimpleDraweeView;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by Administrator on 2016/7/14.
 */
public class HotAdapter extends RecyclerView.Adapter<HotAdapter.HotViewHolder> {

    private List<Hot.DataBean.FilmListBean> filmListBeen;
    private Context context;

    public HotAdapter(List<Hot.DataBean.FilmListBean> filmListBeen, Context context) {
        this.filmListBeen = filmListBeen;
        this.context = context;
    }

    private HotListener listener;

    public void setListener(HotListener listener) {
        this.listener = listener;
    }

    interface HotListener {

    }

    @Override
    public HotViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        HotViewHolder holder1 = null;
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_hot, null);
        holder1 = new HotViewHolder(view);
        return holder1;
    }

    @Override
    public void onBindViewHolder(HotViewHolder holder, int position) {
        holder.textviewTitleLessHot.setText(filmListBeen.get(position).getFilmName());
//        holder.textviewCountLessHot.setText(filmListBeen.get(position).getCinemaCount());
//        holder.textviewInfoLessHot.setText(filmListBeen.get(position).getShortIntro());
//        holder.textviewYouhuiHot.setText(filmListBeen.get(position).getYouhui().getYouhuiLabel());
//        holder.textviewYouhuiDetailsHot.setText(filmListBeen.get(position).getYouhui().getYouhuiTitle());
//        holder.textviewMessageHot.setText(filmListBeen.get(position).getInformation().getTitle());
        Glide.with(context).load(filmListBeen.get(position).getHorizontalLogo()).into(holder.simpleDraweeView);
    }

    @Override
    public int getItemCount() {
        return filmListBeen.size();
    }

    class HotViewHolder extends RecyclerView.ViewHolder {
        //        @InjectView(R.id.imageview_hot)
//        ImageView imageviewHot;
//        @InjectView(R.id.textview_title_less_hot)
//        TextView textviewTitleLessHot;
//        @InjectView(R.id.textview_grade_first_hot)
//        TextView textviewGradeFirstHot;
//        @InjectView(R.id.textview_grade_last_hot)
//        TextView textviewGradeLastHot;
//        @InjectView(R.id.textview_info_less_hot)
//        TextView textviewInfoLessHot;
//        @InjectView(R.id.textview_count_less_hot)
//        TextView textviewCountLessHot;
//        @InjectView(R.id.textview_youhui_hot)
//        TextView textviewYouhuiHot;
//        @InjectView(R.id.textview_youhui_details_hot)
//        TextView textviewYouhuiDetailsHot;
//        @InjectView(R.id.layout_youhui_hot)
//        LinearLayout layoutYouhuiHot;
//        @InjectView(R.id.textview_message_hot)
//        TextView textviewMessageHot;
//        @InjectView(R.id.textview_details_hot)
//        TextView textviewDetailsHot;
//        @InjectView(R.id.layout_message_hot)
//        LinearLayout layoutMessageHot;
        TextView textviewTitleLessHot;
        ImageView simpleDraweeView;

        public HotViewHolder(View itemView) {
            super(itemView);
            ButterKnife.inject(this, itemView);
            textviewTitleLessHot = (TextView) itemView.findViewById(R.id.textview_title_less_hot);
            simpleDraweeView = (ImageView) itemView.findViewById(R.id.simple_drawee_view);
        }
    }
}
